<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  //浅拷贝只能拷贝外面的一层
  let obj = {
    name: "cz",
    age: 18
  };
  let objs = {};
  for (let key in obj) {
    objs[key] = obj[key];
  };
  console.log(objs);

  console.log(`===================================`);
  // 可以使用Object.assign("拷贝给谁","要拷贝的对象");
  let objy = {};
  Object.assign(objy, obj);

  console.log(objy);
</script>

</html>